home *** CD-ROM | disk | FTP | other *** search
/ A is for ART, C is for Cezanne / A is for ART, C is for Cezanne.iso / mac / MEDIA / CEZANNE.DIR / 00009_Script_BUTTONS < prev    next >
Text File  |  1996-05-28  |  5KB  |  188 lines

  1. -- Buttons use global ref (member) to avoid the confusion of memberNum
  2. -- e.g. set the member of sprite x = the number of member y of castlib z
  3.  
  4. GLOBAL gScreen,gPainting,gSubjList,gScreenList,gTruckBtn,gMusList,gABCbtn, gSketchBtn
  5. GLOBAL gAnimON, gAnimBtn, gDot, gHelpOn, gHelpBtn, hand
  6.  
  7. PROPERTY rollbtn,normBtn,dnBtn,chan,btnSnd,btnAction,destScr,isOn,coldBtn --,inTransit
  8. PROPERTY rollStates, rollNum
  9.  
  10. on new me,btnName,channel,soundName,action,destination, rolls  --,whatToDoInTransit
  11.   set btnAction = action
  12.   set destScr = destination
  13.   set rollBtn = the number of member(btnName&"Roll") of castLib "BTNS"
  14.   set dnBtn = the number of member(btnName&"Dn") of castLib "BTNS"
  15.   set normBtn = the number of member btnName of castLib "BTNS"
  16.   set coldBtn = the number of member(btnName &"COLD") of castLib "BTNS"
  17.   set chan = channel
  18.   set btnSnd = soundName
  19.   set isOn = TRUE
  20.   if not voidP(rolls) then 
  21.     set rollStates = rolls -1
  22.     set rollNum = 0
  23.   end if
  24.   return me
  25. end
  26.  
  27. on renameBtn me, newName  
  28.   -- backBtn on subject screen is "menuBackBtn"
  29.   -- function also used to change Truck btn (add/remove) & sketchBookBtn
  30.   set normBtn = the number of member newName of castLib "BTNS"
  31.   set rollBtn = the number of member(newName&"Roll") of castLib "BTNS"
  32.   set dnBtn = the number of member(newName&"Dn") of castLib "BTNS"
  33. end 
  34.  
  35. on setChannel me, channel
  36.   set chan = channel
  37. end
  38.  
  39. on pressDn me
  40.   if isOn = false then exit
  41.   downBtn me
  42.   repeat while the mouseDown
  43.   end repeat
  44.   cursor 4
  45.   if gAnimON then closeAnim gPainting  --SUBJECT SCR
  46.   doBtnFunction me
  47. end
  48.  
  49. on select me, spriteNum
  50.   set chan = spriteNum
  51.   repeat while the mouseDown
  52.     nothing
  53.   end repeat
  54.   doBtnFunction me
  55. end 
  56.  
  57. on clickHelp me
  58.   repeat while the mouseDown
  59.     nothing
  60.   end repeat
  61.   doBtnFunction me
  62. end 
  63.  
  64. on updateHelpChan me
  65.   set the chan of me = the helpChan of gScreen
  66. end 
  67.  
  68. on doBtnFunction me
  69.   if rollover(chan) then 
  70.     puppetSound member btnSnd  of castLib "BTNS"
  71.     updateStage  
  72.     do btnAction
  73.   end if
  74. end 
  75.  
  76. on rolloverBtn me
  77.   if isOn = FALSE then exit
  78.   puppetSprite chan, TRUE
  79.   if voidP(rollstates) then set the member of sprite chan = rollBtn
  80.   else 
  81.     ------ castmembers must be in order in the castLib
  82.     set the member of sprite chan = (rollBtn + rollNum)
  83.     if rollNum = rollstates then set rollNum = 0
  84.     else set rollNum = rollNum + 1
  85.   end if
  86. end
  87.  
  88. on normalBtn me
  89.   puppetSprite chan, TRUE
  90.   if isOn = false then 
  91.     set the member of sprite chan = coldBtn
  92.   else 
  93.     set the member of sprite chan = normBtn
  94.   end if
  95.   set rollNum = 0
  96. end
  97.  
  98. on downBtn me
  99.   set the member of sprite chan = dnBtn
  100.   updateStage
  101.   set rollNum = 0
  102. end
  103.  
  104. on changeCuration me
  105.   if gHelpOn then
  106.     set gHelpON = 70
  107.     set the member of sprite (the helpChan of gScreen) = the number of member "FRONT.H" of castLib "HELP"
  108.     --puppetsound 0
  109.   end if
  110.   if the inMuseum of gPainting = TRUE then 
  111.     set the inMuseum of gPainting = FALSE
  112.     set num = getPos(gMusList,value("#"&the picName of gPainting))
  113.     set where = getPropAt(gMusList, num)  --#bin or #1, #2, etc
  114.     deleteAt(gMusList,num)
  115.     if where = #bin then deleteOne(gBinList,the picName of gPainting)
  116.     else 
  117.       ----- delete the pic from the room list
  118.       deleteProp(value("gWallList" & where),the picName of gPainting)
  119.     end if
  120.     updateCuratorBtn me
  121.   else 
  122.     add(gBinList,the picName of gPainting)
  123.     addProp gMusList,value(#bin),value("#"&the picName of gPainting) -- #loc:symbol
  124.     set the inMuseum of gPainting = TRUE
  125.     updateCuratorBtn me
  126.     driveTruck me
  127.   end if
  128. end
  129.  
  130. on driveTruck me
  131.   normalBtn me
  132.   set truckNum = the number of member "driveBy" of castLib "BTNS"
  133.   set the member of sprite 41 = truckNum
  134.   updateStage
  135.   repeat with x = 1 to 20
  136.     holdON 7
  137.     set the member of sprite 41 = truckNum + x
  138.     updateStage
  139.   end repeat
  140.   holdON 7
  141.   set the member of sprite 41 = gDot
  142.   updateStage
  143. end
  144.  
  145. on updateCuratorBtn me
  146.   if the inMuseum of gPainting = FALSE then 
  147.     set isOn = #add
  148.     renameBtn me, "addMusBtn"
  149.   else 
  150.     set isOn = #remove
  151.     renameBtn me, "remMusBtn"
  152.   end if
  153. end
  154.  
  155. on updateABCbtn me, abcVal 
  156.   set isOn = min(abcVal,1)
  157. end
  158.  
  159. on updateAnimBtn me, isOnVal
  160.   set isOn = isOnVal
  161.   set gAnimOn = not isOnVal
  162.   normalBtn me
  163.   updateStage
  164. end
  165.  
  166. on toggleBin me, destScr
  167.   if destScr = #close then --close the bin
  168.     set the member of sprite 33 = gDot  -- binBack
  169.     set the rect of sprite 33 = rect(427, 372, 427, 372)
  170.     set the member of sprite 38 = gDot -- binFront
  171.     set the isOn of (getProp(the btnList of gScreen,18)) = FALSE  --remBinBtn
  172.     renameBtn me, "binOpenBtn"
  173.     set the destScr of me = #open
  174.     repeat with x = 35 to 37
  175.       set the member of sprite x = gDot
  176.     end repeat
  177.     set the rect of sprite 37 =  rect(381, 286, 381, 287)
  178.     -- set the cursor of sprite 13 = 0
  179.     checkBtns gScreen --to update btns immediately
  180.   else
  181.     showBin  --see  MUSEUM MOVIE SCRIPT
  182.   end if
  183. end
  184.  
  185. on resetBinBtn me
  186.   renameBtn me, "binCloseBtn"
  187.   set the destScr of me = #close
  188. end